/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package restaurante;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;

/**
 *
 * @author 66785403
 */
public class ScrollButtons extends Region {

    private Button rightRec, bottomRec;
    public boolean topClicked = false, rightClicked = false;
    private Image arrowUp;

    public ScrollButtons() {
        this.setId("scroll-button");
        arrowUp = new Image(ScrollButtons.class.getResourceAsStream("images/arrow_up.png"));
        rightRec = new Button("", new ImageView(arrowUp));
        rightRec.setId("up");
        rightRec.setLayoutX(50);
        rightRec.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent t) {
                topClicked = true;
            }
        });
//        rightRec.setOnMouseReleased(new EventHandler<MouseEvent>() {
//
//            @Override
//            public void handle(MouseEvent t) {
//                topClicked = false;
//            }
//        });
        this.getChildren().add(rightRec);

        //Add handler
        this.setOnMousePressed(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent t) {
                if (topClicked) {
                    System.out.println("left clicked");
                } else {
                    t.consume();
                }
            }
        });
    }
}
